IF(MSVC)
    SET(LIBS ${ZPSOE_LIB_NAME} ${GTEST_BOTH_LIBRARIES})
ELSE()
    SET(LIBS ${ZPSOE_LIB_NAME} ${GTEST_BOTH_LIBRARIES} pthread)
ENDIF()

# zalgorithm {
ADD_EXECUTABLE(zdouble_unittest zalgorithm/zdouble_unittest.cxx)
TARGET_LINK_LIBRARIES(zdouble_unittest ${LIBS})
ADD_TEST(NAME zdouble_unittest COMMAND zdouble_unittest)

ADD_EXECUTABLE(zint_unittest zalgorithm/zint_unittest.cxx)
TARGET_LINK_LIBRARIES(zint_unittest ${LIBS})
ADD_TEST(NAME zint_unittest COMMAND zint_unittest)

ADD_EXECUTABLE(zarray_unittest zalgorithm/zarray_unittest.cxx)
TARGET_LINK_LIBRARIES(zarray_unittest ${LIBS})
ADD_TEST(NAME zarray_unittest COMMAND zarray_unittest)

ADD_EXECUTABLE(zpath_unittest zalgorithm/zpath_unittest.cxx)
TARGET_LINK_LIBRARIES(zpath_unittest ${LIBS})
ADD_TEST(NAME zpath_unittest COMMAND zpath_unittest)

ADD_EXECUTABLE(zrandom_unittest zalgorithm/zrandom_unittest.cxx)
TARGET_LINK_LIBRARIES(zrandom_unittest ${LIBS})
ADD_TEST(NAME zrandom_unittest COMMAND zrandom_unittest)

ADD_EXECUTABLE(zstring_unittest zalgorithm/zstring_unittest.cxx)
TARGET_LINK_LIBRARIES(zstring_unittest ${LIBS})
ADD_TEST(NAME zstring_unittest COMMAND zstring_unittest)

ADD_EXECUTABLE(ztime_unittest zalgorithm/ztime_unittest.cxx)
TARGET_LINK_LIBRARIES(ztime_unittest ${LIBS})
ADD_TEST(NAME ztime_unittest COMMAND ztime_unittest)

ADD_EXECUTABLE(zunit_unittest zalgorithm/zunit_unittest.cxx)
TARGET_LINK_LIBRARIES(zunit_unittest ${LIBS})
ADD_TEST(NAME zunit_unittest COMMAND zunit_unittest)

ADD_EXECUTABLE(zdomain_unittest zalgorithm/zdomain_unittest.cxx)
TARGET_LINK_LIBRARIES(zdomain_unittest ${LIBS})
ADD_TEST(NAME zdomain_unittest COMMAND zdomain_unittest)

ADD_EXECUTABLE(zip_unittest zalgorithm/zip_unittest.cxx)
TARGET_LINK_LIBRARIES(zip_unittest ${LIBS})
ADD_TEST(NAME zip_unittest COMMAND zip_unittest)
# } // end of zalgorithm


ADD_EXECUTABLE(zexception_unittest zexception_unittest.cxx)
TARGET_LINK_LIBRARIES(zexception_unittest ${LIBS})
ADD_TEST(NAME zexception_unittest COMMAND zexception_unittest)

ADD_EXECUTABLE(zcmd_unittest zcmd_unittest.cxx)
TARGET_LINK_LIBRARIES(zcmd_unittest ${LIBS})
ADD_TEST(NAME zcmd_unittest COMMAND zcmd_unittest)

ADD_EXECUTABLE(zerrno_unittest zerrno_unittest.cxx)
TARGET_LINK_LIBRARIES(zerrno_unittest ${LIBS})
ADD_TEST(NAME zerrno_unittest COMMAND zerrno_unittest)

ADD_EXECUTABLE(zfilesys_unittest zfilesys_unittest.cxx)
TARGET_LINK_LIBRARIES(zfilesys_unittest ${LIBS})
ADD_TEST(NAME zfilesys_unittest COMMAND zfilesys_unittest)

ADD_EXECUTABLE(zlog_unittest zlog_unittest.cxx)
TARGET_LINK_LIBRARIES(zlog_unittest ${LIBS})
ADD_TEST(NAME zlog_unittest COMMAND zlog_unittest)

ADD_DEFINITIONS("-DCURRENT_WORK_DIR=\"${CMAKE_BINARY_DIR}/test\"")
ADD_DEFINITIONS("-DCURRENT_EXE_DIR=\"${CMAKE_BINARY_DIR}/bin\"")
IF(MSVC)
    ADD_DEFINITIONS("-DCURRENT_EXE_PATH=\"${CMAKE_BINARY_DIR}/bin/zproc_unittest.exe\"")
ELSE()
    ADD_DEFINITIONS("-DCURRENT_EXE_PATH=\"${CMAKE_BINARY_DIR}/bin/zproc_unittest\"")
ENDIF()
ADD_EXECUTABLE(zproc_unittest zproc_unittest.cxx)
TARGET_LINK_LIBRARIES(zproc_unittest ${LIBS})
ADD_TEST(NAME zproc_unittest COMMAND zproc_unittest)
SET_TARGET_PROPERTIES(zproc_unittest PROPERTIES
    RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/bin"
)
